package com.yaowk.system.server.service.impl;

import com.yaowk.common.api.BaseException;
import com.yaowk.common.api.BaseServiceImpl;
import com.yaowk.system.api.LoginApi;
import com.yaowk.system.api.model.Login;
import com.yaowk.system.server.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl extends BaseServiceImpl<Login, Long> implements ILoginService {

    @Autowired
    private LoginApi loginApi;

    @Override
    public void login(Login login) {
        if (login.isNew()) {
            loginApi.save(login);
        } else {
            throw new BaseException("id 已存在");
        }
    }
}
